<div class="container">
    <div class="row">
        <div class="span3">

            <div class="property-filter pull-right">

                <div class="content">
                    <?php
                    $form = $this->beginWidget('CActiveForm', array(
                        'id' => 'search-form',
                        'action' => '/',
                        'enableAjaxValidation' => true,
                        'clientOptions' => array('validateOnSubmit' => true, 'validateOnType' => false),
                    ));
                    ?>
                    <form method="get" action="?">

                        <div class="location control-group">
                            <label class="control-label" for="inputLocation">
                                Город
                            </label>
                            <div class="controls">
                                <?php echo $form->dropDownList($model, 'city_id', CHtml::listData(City::model()->getActiveCity(), 'id', 'name'), array('empty' => 'Выберите ...')); ?>
                            </div><!-- /.controls -->
                        </div><!-- /.control-group -->

                        <div class="beds control-group">
                            <label class="control-label" for="inputBeds">
                                Тип
                            </label>
                            <div class="controls">
                                <?php echo $form->dropDownList($model, 'type_id', Flat::getTypeFlat(), array('empty' => 'Выберите ...')); ?>
                            </div><!-- /.controls -->
                        </div><!-- /.control-group -->

                        <div class="baths control-group">
                            <label class="control-label" for="inputBaths">
                                Гости
                            </label>
                            <div class="controls">
                                <?php echo $form->dropDownList($model, 'guests', Flat::getSleeper(), array('empty' => 'Выберите ...')); ?>
                            </div><!-- /.controls -->
                        </div><!-- /.control-group -->

                        <div class="price-from control-group">
                            <label class="control-label" for="inputPriceFrom">
                                Price from
                            </label>
                            <div class="controls">
                                <?php
                                echo $form->textField($model, 'inputPriceFrom', array(
                                    'id' => 'inputPriceFrom',
                                ))
                                ?>
                            </div><!-- /.controls -->
                        </div><!-- /.control-group -->

                        <div class="price-to control-group">
                            <label class="control-label" for="inputPriceTo">
                                Price to
                            </label>
                            <div class="controls">
                                <?php
                                echo $form->textField($model, 'inputPriceTo', array(
                                    'id' => 'inputPriceTo',
                                ))
                                ?>
                            </div><!-- /.controls -->
                        </div><!-- /.control-group -->

                        <div class="price-value">
                            <span class="from"></span><!-- /.from -->
                            -
                            <span class="to"></span><!-- /.to -->
                             грн./сутки
                        </div><!-- /.price-value -->

                        <div class="price-slider">
                        </div><!-- /.price-slider -->

                        <div class="form-actions">
                            <input type="submit" value="Найти" class="btn btn-primary btn-large">
                        </div><!-- /.form-actions -->
                        <?php $this->endWidget(); ?>
                </div><!-- /.content -->

            </div><!-- /.property-filter -->
        </div><!-- /.span3 -->
    </div><!-- /.row -->
</div><!-- /.container -->


<script language="JavaScript">
    $(document).ready(function() {
        InitPriceSlider();
    });

    function InitPriceSlider() {
        jQuery('.price-value .from').text(<?= !empty($model->inputPriceFrom) ? $model->inputPriceFrom : $price['min']; ?>);
        //jQuery('.price-value .from').currency({region: 'EUR', thousands: ' ', decimal: ',', decimals: 0});

        jQuery('.price-value .to').text(<?= !empty($model->inputPriceTo) ? $model->inputPriceTo : $price['max']; ?>);
        //jQuery('.price-value .to').currency({region: 'EUR', thousands: ' ', decimal: ',', decimals: 0});

        $('.property-filter .price-slider').slider({
            range: true,
            min: <?= $price['min']; ?>,
            max: <?= $price['max']; ?>,
            values: [<?= !empty($model->inputPriceFrom) ? $model->inputPriceFrom : $price['min']; ?>, <?= !empty($model->inputPriceTo) ? $model->inputPriceTo : $price['max']; ?>],
            slide: function(event, ui) {
                jQuery('.property-filter .price-from input').attr('value', ui.values[0]);
                jQuery('.property-filter .price-to input').attr('value', ui.values[1]);

                jQuery('.price-value .from').text(ui.values[0]);
                //jQuery('.price-value .from').currency({region: 'EUR', thousands: ' ', decimal: ',', decimals: 0});

                jQuery('.price-value .to').text(ui.values[1]);
                //jQuery('.price-value .to').currency({region: 'EUR', thousands: ' ', decimal: ',', decimals: 0});
            }
        });
    }
</script>